/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package guzik.lukasz.SnpLoginEngine;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.AbstractAction;
import javax.swing.Action;
import org.openide.util.NbBundle;

public final class LoginAction extends AbstractAction implements ActionListener
{
    private static LoginAction instance = null;

    private LoginAction()
    {
	putValue(Action.NAME, NbBundle.getMessage(LoginAction.class, "CTL_LoginAction"));
    }

    public static LoginAction getInstance()
    {
	if(instance == null)
	{
	    instance = new LoginAction();
	}

	return instance;
    }

    @Override
    public void actionPerformed(ActionEvent e)
    {
	LoginEngineImpl.getInstance().login();
    }

    @Override
    public boolean isEnabled()
    {
	return !LoginEngineImpl.getInstance().isLogin();
    }


}
